from selenium.webdriver.common.by import By

from base import Base
class Page(Base):
    # 搜索
    def sousuo(self):
        loc=(By.XPATH,'//android.widget.TextView[@text="搜商品名称 作者 出版社 ISBN"]')
        ele=self.find_ele(loc)
        return ele
    # 输入搜索
    def sousuo2(self):
        loc=(By.CLASS_NAME,'android.widget.EditText')
        ele=self.find_ele(loc)
        return ele
    # 点击搜索
    def dianjisousuo(self):
        loc=(By.ID,'com.kongfz.app:id/tvSearch')
        ele=self.find_ele(loc)
        return ele
    # 点击图片
    def tupian(self):
        loc=(By.ANDROID_UIAUTOMATOR,'new UiSelector().resourceId("com.kongfz.app:id/ivPic").instance(6)')
        ele=self.find_ele(loc)
        return ele
    # 加入购物车
    def jiarugouwuche(self):
        loc=(By.ID,'com.kongfz.app:id/tvAddCart1')
        ele=self.find_ele(loc)
        return ele
    # 点击购物车
    def dianjigouwuche(self):
        self.driver.tap([(287,1524)],300)
    # 断言
    def duanyan(self):
        loc=(By.ANDROID_UIAUTOMATOR,'new UiSelector().text("全新")')
        ele=self.find_ele(loc)
        return ele
    def bawu(self):
        loc=(By.ANDROID_UIAUTOMATOR,'new UiSelector().text("八五品")')
        ele=self.find_ele(loc)
        return ele
    def jiuwu(self):
        loc=(By.ANDROID_UIAUTOMATOR,'new UiSelector().text("九五品")')
        ele=self.find_ele(loc)
        return ele